package com.hxk;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;

import com.hxk.listener.MyListener2;

/**
 * springboot整合listener方式二
 * 通过方法注册
 * @author Cactus
 */
@SpringBootApplication
public class App2 {

	public static void main(String[] args) {
		SpringApplication.run(App2.class, args);
	}
	/**
	 * 注册listener
	 * @return
	 */
	@Bean
	public ServletListenerRegistrationBean<MyListener2> getServletListenerRegistrationBean(){
		ServletListenerRegistrationBean<MyListener2> bean = new ServletListenerRegistrationBean<>(new MyListener2());
		return bean;
	}

}
